bitkeeper revision 1.1159.170.61 (41b601c2hqYXs_GyXCoioNz7m4Q_Cg)
authorcl349@arcadians.cl.cam.ac.uk <cl349@arcadians.cl.cam.ac.uk>
Tue, 7 Dec 2004 19:17:22 +0000 (19:17 +0000)
committercl349@arcadians.cl.cam.ac.uk <cl349@arcadians.cl.cam.ac.uk>
Tue, 7 Dec 2004 19:17:22 +0000 (19:17 +0000)
mem.c:
  cleanup after sync.
balloon.h:
  Rename: linux-2.6.9-xen-sparse/include/asm-xen/balloon.h -> linux-2.6.10-rc2-xen-sparse/include/asm-xen/balloon.h
devmem.c:
  Rename: linux-2.6.9-xen-sparse/arch/xen/kernel/devmem.c -> linux-2.6.10-rc2-xen-sparse/arch/xen/kernel/devmem.c

.rootkeys
linux-2.6.10-rc2-xen-sparse/arch/xen/kernel/devmem.c [new file with mode: 0644]
linux-2.6.10-rc2-xen-sparse/drivers/char/mem.c
linux-2.6.10-rc2-xen-sparse/include/asm-xen/balloon.h [new file with mode: 0644]
linux-2.6.9-xen-sparse/arch/xen/kernel/devmem.c [deleted file]
linux-2.6.9-xen-sparse/include/asm-xen/balloon.h [deleted file]

index e6307ea48c1a37fa6de8d6c2ccafec56f999c213..932dc5ec9dc39d0e7811f616a2832115d4baf250 100644 (file)
--- a/.rootkeys
+++ b/.rootkeys
 4107adf1s5u6249DNPUViX1YNagbUQ linux-2.6.10-rc2-xen-sparse/arch/xen/i386/pci/irq.c
 40f56239zOksGg_H4XD4ye6iZNtoZA linux-2.6.10-rc2-xen-sparse/arch/xen/kernel/Makefile
 40f56239bvOjuuuViZ0XMlNiREFC0A linux-2.6.10-rc2-xen-sparse/arch/xen/kernel/ctrl_if.c
+41ab6fa06JdF7jxUsuDcjN3UhuIAxg linux-2.6.10-rc2-xen-sparse/arch/xen/kernel/devmem.c
 40f56238xFQe9T7M_U_FItM-bZIpLw linux-2.6.10-rc2-xen-sparse/arch/xen/kernel/evtchn.c
 4110f478aeQWllIN7J4kouAHiAqrPw linux-2.6.10-rc2-xen-sparse/arch/xen/kernel/fixup.c
 412dfae9eA3_6e6bCGUtg1mj8b56fQ linux-2.6.10-rc2-xen-sparse/arch/xen/kernel/gnttab.c
 40f5623bc8LKPRO09wY5dGDnY_YCpw linux-2.6.10-rc2-xen-sparse/include/asm-xen/asm-i386/tlbflush.h
 41062ab7uFxnCq-KtPeAm-aV8CicgA linux-2.6.10-rc2-xen-sparse/include/asm-xen/asm-i386/vga.h
 40f5623bxUbeGjkRrjDguCy_Gm8RLw linux-2.6.10-rc2-xen-sparse/include/asm-xen/asm-i386/xor.h
+41af4017PDMuSmMWtSRU5UC9Vylw5g linux-2.6.10-rc2-xen-sparse/include/asm-xen/balloon.h
 40f5623bYNP7tHE2zX6YQxp9Zq2utQ linux-2.6.10-rc2-xen-sparse/include/asm-xen/ctrl_if.h
 40f5623b3Eqs8pAc5WpPX8_jTzV2qw linux-2.6.10-rc2-xen-sparse/include/asm-xen/evtchn.h
 419b4e9367PjTEvdjwavWN12BeBBXg linux-2.6.10-rc2-xen-sparse/include/asm-xen/foreign_page.h
 410a94a4KT6I6X0LVc7djB39tRDp4g linux-2.6.10-rc2-xen-sparse/mm/page_alloc.c
 41505c572m-s9ATiO1LiD1GPznTTIg linux-2.6.10-rc2-xen-sparse/net/core/skbuff.c
 4149ec79wMpIHdvbntxqVGLRZZjPxw linux-2.6.10-rc2-xen-sparse/net/ipv4/raw.c
-41ab6fa06JdF7jxUsuDcjN3UhuIAxg linux-2.6.9-xen-sparse/arch/xen/kernel/devmem.c
-41af4017PDMuSmMWtSRU5UC9Vylw5g linux-2.6.9-xen-sparse/include/asm-xen/balloon.h
 413cb1e4zst25MDYjg63Y-NGC5_pLg netbsd-2.0-xen-sparse/Makefile
 413cb1e5c_Mkxf_X0zimEhTKI_l4DA netbsd-2.0-xen-sparse/mkbuildtree
 413cb1e5kY_Zil7-b0kI6hvCIxBEYg netbsd-2.0-xen-sparse/nbconfig-xen
diff --git a/linux-2.6.10-rc2-xen-sparse/arch/xen/kernel/devmem.c b/linux-2.6.10-rc2-xen-sparse/arch/xen/kernel/devmem.c
new file mode 100644 (file)
index 0000000..ffda098
--- /dev/null
@@ -0,0 +1,158 @@
+/*
+ *  Originally from linux/drivers/char/mem.c
+ *
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ *
+ *  Added devfs support. 
+ *    Jan-11-1998, C. Scott Ananian <cananian@alumni.princeton.edu>
+ *  Shared /dev/zero mmaping support, Feb 2000, Kanoj Sarcar <kanoj@sgi.com>
+ */
+
+#include <linux/config.h>
+#include <linux/mm.h>
+#include <linux/miscdevice.h>
+#include <linux/slab.h>
+#include <linux/vmalloc.h>
+#include <linux/mman.h>
+#include <linux/random.h>
+#include <linux/init.h>
+#include <linux/raw.h>
+#include <linux/tty.h>
+#include <linux/capability.h>
+#include <linux/smp_lock.h>
+#include <linux/devfs_fs_kernel.h>
+#include <linux/ptrace.h>
+#include <linux/device.h>
+#include <asm/pgalloc.h>
+#include <asm/uaccess.h>
+#include <asm/io.h>
+
+static inline int uncached_access(struct file *file, unsigned long addr)
+{
+        if (file->f_flags & O_SYNC)
+                return 1;
+        /* Xen sets correct MTRR type on non-RAM for us. */
+        return 0;
+}
+
+/*
+ * This funcion reads the *physical* memory. The f_pos points directly to the 
+ * memory location. 
+ */
+static ssize_t read_mem(struct file * file, char __user * buf,
+                       size_t count, loff_t *ppos)
+{
+       unsigned long i, p = *ppos;
+       ssize_t read = 0;
+       void *v;
+
+       if ((v = ioremap(p, count)) == NULL) {
+               /*
+                * Some programs (e.g., dmidecode) groove off into weird RAM
+                * areas where no table scan possibly exist (because Xen will
+                * have stomped on them!). These programs get rather upset if
+                 * we let them know that Xen failed their access, so we fake
+                 * out a read of all zeroes. :-)
+                */
+               for (i = 0; i < count; i++)
+                       if (put_user(0, buf+i))
+                               return -EFAULT;
+               return count;
+       }
+       if (copy_to_user(buf, v, count))
+               return -EFAULT;
+       iounmap(v);
+
+       read += count;
+       *ppos += read;
+
+       return read;
+}
+
+static ssize_t write_mem(struct file * file, const char __user * buf, 
+                        size_t count, loff_t *ppos)
+{
+       unsigned long p = *ppos;
+       ssize_t written = 0;
+       void *v;
+
+       if ((v = ioremap(p, count)) == NULL)
+               return -EFAULT;
+       if (copy_to_user(v, buf, count))
+               return -EFAULT;
+       iounmap(v);
+
+       written += count;
+       *ppos += written;
+
+       return written;
+}
+
+static int mmap_mem(struct file * file, struct vm_area_struct * vma)
+{
+       unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
+       int uncached;
+
+       uncached = uncached_access(file, offset);
+       if (uncached)
+               vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+
+       /* Don't try to swap out physical pages.. */
+       vma->vm_flags |= VM_RESERVED;
+
+       /*
+        * Don't dump addresses that are not real memory to a core file.
+        */
+       if (uncached)
+               vma->vm_flags |= VM_IO;
+
+       if (io_remap_page_range(vma, vma->vm_start, offset, 
+                               vma->vm_end-vma->vm_start, vma->vm_page_prot))
+               return -EAGAIN;
+
+       return 0;
+}
+
+/*
+ * The memory devices use the full 32/64 bits of the offset, and so we cannot
+ * check against negative addresses: they are ok. The return value is weird,
+ * though, in that case (0).
+ *
+ * also note that seeking relative to the "end of file" isn't supported:
+ * it has no meaning, so it returns -EINVAL.
+ */
+static loff_t memory_lseek(struct file * file, loff_t offset, int orig)
+{
+       loff_t ret;
+
+       down(&file->f_dentry->d_inode->i_sem);
+       switch (orig) {
+               case 0:
+                       file->f_pos = offset;
+                       ret = file->f_pos;
+                       force_successful_syscall_return();
+                       break;
+               case 1:
+                       file->f_pos += offset;
+                       ret = file->f_pos;
+                       force_successful_syscall_return();
+                       break;
+               default:
+                       ret = -EINVAL;
+       }
+       up(&file->f_dentry->d_inode->i_sem);
+       return ret;
+}
+
+static int open_mem(struct inode * inode, struct file * filp)
+{
+       return capable(CAP_SYS_RAWIO) ? 0 : -EPERM;
+}
+
+struct file_operations mem_fops = {
+       .llseek         = memory_lseek,
+       .read           = read_mem,
+       .write          = write_mem,
+       .mmap           = mmap_mem,
+       .open           = open_mem,
+};
index 35efc7799f80abbe6568bbcec901ad55aeb5b53f..8eae836f01badf8cea3bd00cd095486841051f4b 100644 (file)
@@ -202,17 +202,12 @@ static int mmap_kmem(struct file * file, struct vm_area_struct * vma)
                vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
 #endif
 
-       /* Don't try to swap out physical pages.. */
-       vma->vm_flags |= VM_RESERVED;
-
-       /*
-        * Don't dump addresses that are not real memory to a core file.
-        */
-       if (uncached)
-               vma->vm_flags |= VM_IO;
-
-       if (remap_page_range(vma, vma->vm_start, offset, vma->vm_end-vma->vm_start,
-                            vma->vm_page_prot))
+       /* Remap-pfn-range will mark the range VM_IO and VM_RESERVED */
+       if (remap_pfn_range(vma,
+                           vma->vm_start,
+                           vma->vm_pgoff,
+                           vma->vm_end-vma->vm_start,
+                           vma->vm_page_prot))
                return -EAGAIN;
        return 0;
 }
diff --git a/linux-2.6.10-rc2-xen-sparse/include/asm-xen/balloon.h b/linux-2.6.10-rc2-xen-sparse/include/asm-xen/balloon.h
new file mode 100644 (file)
index 0000000..80ef4ac
--- /dev/null
@@ -0,0 +1,51 @@
+/******************************************************************************
+ * balloon.h
+ *
+ * Xen balloon driver - enables returning/claiming memory to/from Xen.
+ *
+ * Copyright (c) 2003, B Dragovic
+ * Copyright (c) 2003-2004, M Williamson, K Fraser
+ * 
+ * This file may be distributed separately from the Linux kernel, or
+ * incorporated into other software packages, subject to the following license:
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifndef __ASM_BALLOON_H__
+#define __ASM_BALLOON_H__
+
+/*
+ * Inform the balloon driver that it should allow some slop for device-driver
+ * memory activities.
+ */
+extern void balloon_update_driver_allowance(long delta);
+
+/* Give up unmapped pages to the balloon driver. */
+extern void balloon_put_pages(unsigned long *mfn_list, unsigned long nr_mfns);
+
+/*
+ * Prevent the balloon driver from changing the memory reservation during
+ * a driver critical region.
+ */
+extern spinlock_t balloon_lock;
+#define balloon_lock(__flags)   spin_lock_irqsave(&balloon_lock, __flags)
+#define balloon_unlock(__flags) spin_unlock_irqrestore(&balloon_lock, __flags)
+
+#endif /* __ASM_BALLOON_H__ */
diff --git a/linux-2.6.9-xen-sparse/arch/xen/kernel/devmem.c b/linux-2.6.9-xen-sparse/arch/xen/kernel/devmem.c
deleted file mode 100644 (file)
index ffda098..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- *  Originally from linux/drivers/char/mem.c
- *
- *  Copyright (C) 1991, 1992  Linus Torvalds
- *
- *  Added devfs support. 
- *    Jan-11-1998, C. Scott Ananian <cananian@alumni.princeton.edu>
- *  Shared /dev/zero mmaping support, Feb 2000, Kanoj Sarcar <kanoj@sgi.com>
- */
-
-#include <linux/config.h>
-#include <linux/mm.h>
-#include <linux/miscdevice.h>
-#include <linux/slab.h>
-#include <linux/vmalloc.h>
-#include <linux/mman.h>
-#include <linux/random.h>
-#include <linux/init.h>
-#include <linux/raw.h>
-#include <linux/tty.h>
-#include <linux/capability.h>
-#include <linux/smp_lock.h>
-#include <linux/devfs_fs_kernel.h>
-#include <linux/ptrace.h>
-#include <linux/device.h>
-#include <asm/pgalloc.h>
-#include <asm/uaccess.h>
-#include <asm/io.h>
-
-static inline int uncached_access(struct file *file, unsigned long addr)
-{
-        if (file->f_flags & O_SYNC)
-                return 1;
-        /* Xen sets correct MTRR type on non-RAM for us. */
-        return 0;
-}
-
-/*
- * This funcion reads the *physical* memory. The f_pos points directly to the 
- * memory location. 
- */
-static ssize_t read_mem(struct file * file, char __user * buf,
-                       size_t count, loff_t *ppos)
-{
-       unsigned long i, p = *ppos;
-       ssize_t read = 0;
-       void *v;
-
-       if ((v = ioremap(p, count)) == NULL) {
-               /*
-                * Some programs (e.g., dmidecode) groove off into weird RAM
-                * areas where no table scan possibly exist (because Xen will
-                * have stomped on them!). These programs get rather upset if
-                 * we let them know that Xen failed their access, so we fake
-                 * out a read of all zeroes. :-)
-                */
-               for (i = 0; i < count; i++)
-                       if (put_user(0, buf+i))
-                               return -EFAULT;
-               return count;
-       }
-       if (copy_to_user(buf, v, count))
-               return -EFAULT;
-       iounmap(v);
-
-       read += count;
-       *ppos += read;
-
-       return read;
-}
-
-static ssize_t write_mem(struct file * file, const char __user * buf, 
-                        size_t count, loff_t *ppos)
-{
-       unsigned long p = *ppos;
-       ssize_t written = 0;
-       void *v;
-
-       if ((v = ioremap(p, count)) == NULL)
-               return -EFAULT;
-       if (copy_to_user(v, buf, count))
-               return -EFAULT;
-       iounmap(v);
-
-       written += count;
-       *ppos += written;
-
-       return written;
-}
-
-static int mmap_mem(struct file * file, struct vm_area_struct * vma)
-{
-       unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
-       int uncached;
-
-       uncached = uncached_access(file, offset);
-       if (uncached)
-               vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
-
-       /* Don't try to swap out physical pages.. */
-       vma->vm_flags |= VM_RESERVED;
-
-       /*
-        * Don't dump addresses that are not real memory to a core file.
-        */
-       if (uncached)
-               vma->vm_flags |= VM_IO;
-
-       if (io_remap_page_range(vma, vma->vm_start, offset, 
-                               vma->vm_end-vma->vm_start, vma->vm_page_prot))
-               return -EAGAIN;
-
-       return 0;
-}
-
-/*
- * The memory devices use the full 32/64 bits of the offset, and so we cannot
- * check against negative addresses: they are ok. The return value is weird,
- * though, in that case (0).
- *
- * also note that seeking relative to the "end of file" isn't supported:
- * it has no meaning, so it returns -EINVAL.
- */
-static loff_t memory_lseek(struct file * file, loff_t offset, int orig)
-{
-       loff_t ret;
-
-       down(&file->f_dentry->d_inode->i_sem);
-       switch (orig) {
-               case 0:
-                       file->f_pos = offset;
-                       ret = file->f_pos;
-                       force_successful_syscall_return();
-                       break;
-               case 1:
-                       file->f_pos += offset;
-                       ret = file->f_pos;
-                       force_successful_syscall_return();
-                       break;
-               default:
-                       ret = -EINVAL;
-       }
-       up(&file->f_dentry->d_inode->i_sem);
-       return ret;
-}
-
-static int open_mem(struct inode * inode, struct file * filp)
-{
-       return capable(CAP_SYS_RAWIO) ? 0 : -EPERM;
-}
-
-struct file_operations mem_fops = {
-       .llseek         = memory_lseek,
-       .read           = read_mem,
-       .write          = write_mem,
-       .mmap           = mmap_mem,
-       .open           = open_mem,
-};
diff --git a/linux-2.6.9-xen-sparse/include/asm-xen/balloon.h b/linux-2.6.9-xen-sparse/include/asm-xen/balloon.h
deleted file mode 100644 (file)
index 80ef4ac..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/******************************************************************************
- * balloon.h
- *
- * Xen balloon driver - enables returning/claiming memory to/from Xen.
- *
- * Copyright (c) 2003, B Dragovic
- * Copyright (c) 2003-2004, M Williamson, K Fraser
- * 
- * This file may be distributed separately from the Linux kernel, or
- * incorporated into other software packages, subject to the following license:
- * 
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this source file (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy, modify,
- * merge, publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
-
-#ifndef __ASM_BALLOON_H__
-#define __ASM_BALLOON_H__
-
-/*
- * Inform the balloon driver that it should allow some slop for device-driver
- * memory activities.
- */
-extern void balloon_update_driver_allowance(long delta);
-
-/* Give up unmapped pages to the balloon driver. */
-extern void balloon_put_pages(unsigned long *mfn_list, unsigned long nr_mfns);
-
-/*
- * Prevent the balloon driver from changing the memory reservation during
- * a driver critical region.
- */
-extern spinlock_t balloon_lock;
-#define balloon_lock(__flags)   spin_lock_irqsave(&balloon_lock, __flags)
-#define balloon_unlock(__flags) spin_unlock_irqrestore(&balloon_lock, __flags)
-
-#endif /* __ASM_BALLOON_H__ */